<template>
  <el-row style="width: 97%;">
    <el-col :span="24">
      <h2>展览会、博览会、交易会、评比达标表彰活动</h2>
    </el-col>
    <el-col :span="24">
      <h3>{{ year }}年度举办展览会、博览会、交易会情况</h3>
    </el-col>
    <el-col :span="18" style="margin-bottom: 15px;">
      本年度是否开展活动
      <el-radio-group v-model="isList1">
        <el-radio :label="1">已开展</el-radio>
        <el-radio :label="2">未开展</el-radio>
      </el-radio-group>
    </el-col>
    <el-col :span="6" style="text-align: right;">
      <el-button type="primary" @click="listAdd(1)">新增</el-button>
    </el-col>
    <el-col :span="24" style="margin-bottom: 35px;">
      <el-form :model="expositionList" ref="expositionListRef" style="width:100%;">
        <el-table :header-cell-style="{background: '#F0F5FA',color: '#333333'}" v-show="isList1 == '1'" :data="expositionList" border>
          <el-table-column type="index" label="序号" align="center" width="60" />
          <el-table-column prop="activityName" label="活动名称" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityName'" :rules="expositionRules.activityName">
                <el-input v-model="scope.row.activityName" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>

          <el-table-column prop="activityCycle" label="时间或周期" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityCycle'" :rules="expositionRules.activityCycle">
                <el-input v-model="scope.row.activityCycle" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="scale" label="规模（㎡）" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].scale'" :rules="expositionRules.scale">
                <el-input type="number" v-model="scope.row.scale" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
<!--          <el-table-column prop="organizingMethod" label="举办方式" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].organizingMethod'" :rules="expositionRules.organizingMethod">-->
<!--                <el-select clearable  v-model="scope.row.organizingMethod" filterable placeholder="请选择" style="width: 100%;">-->
<!--                  <el-option-->
<!--                    v-for="dict in eventMethodOptions"-->
<!--                    :key="dict.id"-->
<!--                    :label="dict.name"-->
<!--                    :value="dict.id"-->
<!--                  />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column prop="address" label="地点" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].address'" :rules="expositionRules.address">-->
<!--                <el-input v-model="scope.row.address" placeholder="请输入"></el-input>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column prop="transactionAmount" label="成交金额（万元）" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].transactionAmount'"
                            :rules="expositionRules.transactionAmount">
                <el-input type="number" v-model="scope.row.transactionAmount" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="manufacturerNum" label="参展厂商数" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].manufacturerNum'" :rules="expositionRules.manufacturerNum">
                <el-input type="number" v-model="scope.row.manufacturerNum" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="participateNum" label="参加人数" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].participateNum'" :rules="expositionRules.participateNum">
                <el-input type="number" v-model="scope.row.participateNum" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
<!--          <el-table-column prop="fundingSource" label="	经费来源" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].fundingSource'" :rules="expositionRules.fundingSource">-->
<!--                <el-select clearable  v-model="scope.row.fundingSource" filterable placeholder="请选择" style="width: 100%;">-->
<!--                  <el-option-->
<!--                    v-for="dict in sourceFundingOptions"-->
<!--                    :key="dict.id"-->
<!--                    :label="dict.name"-->
<!--                    :value="dict.id"-->
<!--                  />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            width="80">
            <template #default="scope">
              <el-button type="text"  size="default" @click="listDelete(1,scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </el-col>
    <el-col :span="24">
      <h3>{{ year }}年度举办研讨会、论坛情况</h3>
    </el-col>
    <el-col :span="18" style="margin-bottom: 15px;">
      本年度是否开展活动
      <el-radio-group v-model="isList2">
        <el-radio :label="1">已开展</el-radio>
        <el-radio :label="2">未开展</el-radio>
      </el-radio-group>
    </el-col>
    <el-col :span="6" style="text-align: right;">
      <el-button type="primary" @click="listAdd(2)">新增</el-button>
    </el-col>
    <el-col :span="24" style="margin-bottom: 35px;">
      <el-form :model="workshopList" ref="workshopListRef" style="width:100%;">
        <el-table :header-cell-style="{background: '#F0F5FA',color: '#333333'}" v-show="isList2 == '1'"  size="default" :data="workshopList" border>
          <el-table-column type="index" label="序号" align="center" width="60" />
          <el-table-column prop="activityName" label="活动名称" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityName'" :rules="workshopRules.activityName">
                <el-input v-model="scope.row.activityName" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="participateNum" label="参加人数" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].participateNum'" :rules="workshopRules.participateNum">
                <el-input type="number" v-model="scope.row.participateNum" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="organizingMethod" label="举办方式" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].organizingMethod'" :rules="workshopRules.organizingMethod">
                <el-select clearable  v-model="scope.row.organizingMethod" filterable placeholder="请选择" style="width: 100%;">
                  <el-option
                    v-for="dict in eventMethodOptions"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="address" label="地点" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].address'" :rules="workshopRules.address">
                <el-input v-model="scope.row.address" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="fundingSource" label="经费来源" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].fundingSource'" :rules="workshopRules.fundingSource">
                <el-select clearable  v-model="scope.row.fundingSource" filterable placeholder="请选择" style="width: 100%;">
                  <el-option
                    v-for="dict in sourceFundingOptions"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            width="80">
            <template #default="scope">
              <el-button type="text"  size="default" @click="listDelete(2,scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </el-col>
    <el-col :span="24">
      <h3>{{ year }}年度举办经批准的评比、达标、表彰活动的情况</h3>
    </el-col>
    <el-col :span="18" style="margin-bottom: 15px;">
      本年度是否开展活动
      <el-radio-group v-model="isList3">
        <el-radio :label="1">已开展</el-radio>
        <el-radio :label="2">未开展</el-radio>
      </el-radio-group>
    </el-col>
    <el-col :span="6" style="text-align: right;">
      <el-button type="primary" @click="listAdd(3)">新增</el-button>
    </el-col>
    <el-col :span="24" style="margin-bottom: 35px;">
      <el-form :model="evaluationList" ref="evaluationListRef" style="width:100%;">
        <el-table :header-cell-style="{background: '#F0F5FA',color: '#333333'}" v-show="isList3 == '1'"  size="default" :data="evaluationList" border>
          <el-table-column type="index" label="序号" align="center" width="60" />
          <el-table-column prop="activityName" label="项目名称" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityName'" :rules="evaluationRules.activityName">
                <el-input v-model="scope.row.activityName" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="holdingTime" label="起始时间" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].holdingTime'" :rules="evaluationRules.holdingTime">
                <el-date-picker
                  v-model="scope.row.holdingTime"
                  type="date"
                  value-format="YYYY-MM-DD"
                  placeholder="起始时间">
                </el-date-picker>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="activityCycle" label="活动周期" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityCycle'" :rules="evaluationRules.activityCycle">
                <el-input v-model="scope.row.activityCycle" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="activityClass" label="评选范围或评比对象" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityClass'" :rules="evaluationRules.activityClass">
                <el-input v-model="scope.row.activityClass" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="approvalAuthority" label="批准单位" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].approvalAuthority'"
                            :rules="evaluationRules.approvalAuthority">
                <el-input v-model="scope.row.approvalAuthority" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="fundingSource" label="经费来源" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].fundingSource'" :rules="evaluationRules.fundingSource">
                <el-select clearable  v-model="scope.row.fundingSource" filterable placeholder="请选择" style="width: 100%;">
                  <el-option
                    v-for="dict in sourceFundingOptions"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
<!--          <el-table-column prop="activityType" label="活动类型" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].activityType'" :rules="evaluationRules.activityType">-->
<!--                <el-select clearable  v-model="scope.row.activityType" filterable placeholder="请选择" style="width: 100%;">-->
<!--                  <el-option-->
<!--                    v-for="dict in activityTypeOptions"-->
<!--                    :key="dict.id"-->
<!--                    :label="dict.name"-->
<!--                    :value="dict.id"-->
<!--                  />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column prop="address" label="地点" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].address'" :rules="evaluationRules.address">-->
<!--                <el-input v-model="scope.row.address" placeholder="请输入"></el-input>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column prop="approvalTime" label="审批时间" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].approvalTime'" :rules="evaluationRules.approvalTime">-->
<!--                <el-date-picker-->
<!--                  v-model="scope.row.approvalTime"-->
<!--                  type="date"-->
<!--                  value-format="YYYY-MM-DD"-->
<!--                  placeholder="审批时间">-->
<!--                </el-date-picker>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            width="80">
            <template #default="scope">
              <el-button type="text"  size="default" @click="listDelete(3,scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </el-col>
    <el-col :span="24">
      <h3>{{ year }}年度培训、职称评审、认证、鉴定登活动情况</h3>
    </el-col>
    <el-col :span="18" style="margin-bottom: 15px;">
      本年度是否开展活动
      <el-radio-group v-model="isList4">
        <el-radio :label="1">已开展</el-radio>
        <el-radio :label="2">未开展</el-radio>
      </el-radio-group>
    </el-col>
    <el-col :span="6" style="text-align: right;">
      <el-button type="primary" @click="listAdd(4)">新增</el-button>
    </el-col>
    <el-col :span="24" style="margin-bottom: 35px;">
      <el-form :model="trainList" ref="trainListRef" style="width:100%;">
        <el-table :header-cell-style="{background: '#F0F5FA',color: '#333333'}" :data="trainList" v-show="isList4 == '1'"  size="default" border>
          <el-table-column type="index" label="序号" align="center" width="60" />
          <el-table-column prop="activityName" label="活动名称" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityName'" :rules="trainRules.activityName">
                <el-input v-model="scope.row.activityName" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="activityType" label="类型" align="center" width="150">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityType'" :rules="trainRules.activityType">
                <el-select clearable  v-model="scope.row.activityType" filterable placeholder="请选择">
                  <el-option
                    v-for="dict in activityTypeOptions"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="activityCycle" label="时间或周期" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityCycle'" :rules="trainRules.activityCycle">
                <el-input v-model="scope.row.activityCycle" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="activityClass" label="对象" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].activityClass'" :rules="trainRules.activityClass">
                <el-input v-model="scope.row.activityClass" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="address" label="地点" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].address'" :rules="trainRules.address">
                <el-input v-model="scope.row.address" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="approvalAuthority" label="批准单位" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].approvalAuthority'" :rules="trainRules.approvalAuthority">
                <el-input v-model="scope.row.approvalAuthority" placeholder="请输入"></el-input>
              </el-form-item>
            </template>
          </el-table-column>
          <el-table-column prop="fundingSource" label="经费来源" align="center" width="200">
            <template #default="scope">
              <el-form-item :prop="'[' + scope.$index + '].fundingSource'" :rules="trainRules.fundingSource">
                <el-select clearable  v-model="scope.row.fundingSource" filterable placeholder="请选择">
                  <el-option
                    v-for="dict in sourceFundingOptions"
                    :key="dict.id"
                    :label="dict.name"
                    :value="dict.id"
                  />
                </el-select>
              </el-form-item>
            </template>
          </el-table-column>
<!--          <el-table-column prop="holdingTime" label="举办时间" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].holdingTime'" :rules="trainRules.holdingTime">-->
<!--                <el-date-picker-->
<!--                  v-model="scope.row.holdingTime"-->
<!--                  type="date"-->
<!--                  value-format="YYYY-MM-DD"-->
<!--                  placeholder="举办时间">-->
<!--                </el-date-picker>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
<!--          <el-table-column prop="approvalTime" label="审批时间" align="center">-->
<!--            <template #default="scope">-->
<!--              <el-form-item :prop="'[' + scope.$index + '].approvalTime'" :rules="trainRules.approvalTime">-->
<!--                <el-date-picker-->
<!--                  v-model="scope.row.approvalTime"-->
<!--                  type="date"-->
<!--                  value-format="YYYY-MM-DD"-->
<!--                  placeholder="审批时间">-->
<!--                </el-date-picker>-->
<!--              </el-form-item>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column
            fixed="right"
            label="操作"
            align="center"
            width="80">
            <template #default="scope">
              <el-button type="text"  size="default" @click="listDelete(4,scope.$index)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </el-col>
  </el-row>
</template>
<script>
import {
  getDictByCode,
  getTableInfoByPage,
  stSaveCommendation, stSaveEvaluation,
  stSaveExposition, stSaveWorkshop
} from '@/views/yearCheck/ykb/st/st'

export default {
  data() {
    return {
      year: undefined,
      isList1: 2,
      isList2: 2,
      isList3: 2,
      isList4: 2,
      sourceFundingOptions: undefined,
      eventMethodOptions: undefined,
      activityTypeOptions: undefined,
      sexOptions: [{ id: '1', name: '男' }, { id: '2', name: '女' }],
      shiOptions: [{ id: '1', name: '是' }, { id: '2', name: '否' }],
      expositionForm: {
        activityCycle:'',//活动周期
        activityName: '',//活动名称
        address: '',//地点
        creditCode: localStorage.getItem('creditCode'),//统一社会信用代码
        examineYear: localStorage.getItem('examineYear'),//审查年度
        fundingSource: '',//经费来源
        holdingTime: '',//($date-time)举办时间
        id: '',//
        manufacturerNum: '',//参展厂商数
        organizationBaseId: '',//社团组织id
        organizingMethod: '',//举办方式
        participateNum: '',//参加人数
        scale: '',//规模
        transactionAmount: ''//成交金额
      },
      workshopForm: {
        activityName: '',//活动名称
        address: '',//地点
        creditCode: localStorage.getItem('creditCode'),//统一社会信用代码
        examineYear: localStorage.getItem('examineYear'),//审查年度
        fundingSource: '',//经费来源
        holdingTime: '',//($date-time)举办时间
        id: '',//研讨活动id
        organizationBaseId: '',//组织id
        organizingMethod: '',//举办方式
        participateNum: ''//参加人数
      },
      evaluationForm: {
        activityName: '',//项目名称
        holdingTime: '',//起始时间
        activityCycle: '',//活动周期
        activityClass: '',//评选范围或评比对象
        approvalAuthority: '',//批准单位
        fundingSource: '',//经费来源
        activityType: '',//活动类型
        address: '',//地点
        approvalTime: '',//($date-time)审批时间yyyy-MM-dd
        creditCode: localStorage.getItem('creditCode'),//统一社会信用代码
        examineYear: localStorage.getItem('examineYear'),//审查年度
        id: '',//评比表彰id
        organizationBaseId: '',//社团组织id
        recordType: ''//记录类型
      },
      trainForm: {
        activityName: '',//活动名称
        activityType: '',//类型
        activityCycle: '',//时间或周期
        activityClass: '',//对象
        address: '',//地点
        approvalAuthority: '',//批准单位
        fundingSource: '',//经费来源
        approvalTime: '',//($date-time)审批时间
        creditCode: localStorage.getItem('creditCode'),//统一社会信用代码
        examineYear: localStorage.getItem('examineYear'),//审查年度
        holdingTime: '',//($date-time)举办时间
        id: '',//
        organizationBaseId: '',//社团组织id
        recordType: ''//记录类型
      },
      //举办展览会、博览会、交易会
      expositionList: [],
      //研讨会 论坛
      workshopList: [],
      //举办评比达标彰情况对象
      evaluationList: [],
      //培训 职称评审 认证
      trainList: [],
      //举办展览会、博览会、交易会
      expositionRules: {
        activityName: [{ required: true, message: '请完善',trigger: 'blur'}],
        address: [{ required: true, message: '请完善',trigger: 'blur' }],
        fundingSource: [{ required: true, message: '请完善',trigger: 'blur' }],
        holdingTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        manufacturerNum: [{ required: true, message: '请完善',trigger: 'blur' }],
        organizingMethod: [{ required: true, message: '请完善',trigger: 'blur' }],
        participateNum: [{ required: true, message: '请完善',trigger: 'blur' }],
        scale: [{ required: true, message: '请完善',trigger: 'blur' }],
        transactionAmount: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityCycle:[{ required: true, message: '请完善',trigger: 'blur' }]
      },
      workshopRules: {
        activityName: [{ required: true, message: '请完善',trigger: 'blur' }],
        address: [{ required: true, message: '请完善',trigger: 'blur' }],
        fundingSource: [{ required: true, message: '请完善',trigger: 'blur' }],
        holdingTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        organizingMethod: [{ required: true, message: '请完善',trigger: 'blur' }],
        participateNum: [{ required: true, message: '请完善',trigger: 'blur' }]
      },
      evaluationRules: {
        activityClass: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityCycle: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityName: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityType: [{ required: true, message: '请完善',trigger: 'blur' }],
        address: [{ required: true, message: '请完善',trigger: 'blur' }],
        approvalAuthority: [{ required: true, message: '请完善',trigger: 'blur' }],
        approvalTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        fundingSource: [{ required: true, message: '请完善',trigger: 'blur' }],
        holdingTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        recordType: [{ required: true, message: '请完善',trigger: 'blur' }]
      },
      trainRules: {
        activityClass: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityCycle: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityName: [{ required: true, message: '请完善',trigger: 'blur' }],
        activityType: [{ required: true, message: '请完善',trigger: 'blur' }],
        address: [{ required: true, message: '请完善',trigger: 'blur' }],
        approvalAuthority: [{ required: true, message: '请完善',trigger: 'blur' }],
        approvalTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        fundingSource: [{ required: true, message: '请完善',trigger: 'blur' }],
        holdingTime: [{ required: true, message: '请完善',trigger: 'blur' }],
        recordType: [{ required: true, message: '请完善',trigger: 'blur' }]
      }
    }
  },
  created() {

  },
  methods: {
    listDelete(index, position) {
      if (index == 1) {
        this.expositionList.splice(position, 1)
      } else if (index == 2) {
        this.workshopList.splice(position, 1)
      } else if (index == 3) {
        this.evaluationList.splice(position, 1)
      } else if (index == 4) {
        this.trainList.splice(position, 1)
      }
    },
    listAdd(index) {
      if (index == 1) {
        this.expositionList.push({ ...this.expositionForm })
        this.isList1 = 1
      } else if (index == 2) {
        this.workshopList.push({ ...this.workshopForm })
        this.isList2 = 1
      } else if (index == 3) {
        this.evaluationList.push({ ...this.evaluationForm })
        this.isList3 = 1
      } else if (index == 4) {
        this.trainList.push({ ...this.trainForm })
        this.isList4 = 1
      }
    },
    postInfo() {
      this.$refs.expositionListRef.validate(valid=> {
        if (valid) {
          if(this.expositionList == null || this.expositionList.length == 0){
            return;
          }
          for (let i = 0; i < this.expositionList.length; i++) {
            this.expositionList[i].creditCode = localStorage.getItem("creditCode");
            this.expositionList[i].examineYear = localStorage.getItem("examineYear");
          }
          stSaveExposition(this.expositionList).then(response => {
            this.$message({
              message: '保存举办展览会、博览会、交易会成功',
              type: 'success'
            })
            this.getInfo();
          })
        }else{
          this.$message({
            message: '请填写完整！',
            type: 'error'
          });
        }
      });
      this.$refs.trainListRef.validate(valid=> {
        if (valid) {
          if(this.trainList == null || this.trainList.length == 0){
            return;
          }
          for (let i = 0; i < this.trainList.length; i++) {
            this.trainList[i].creditCode = localStorage.getItem("creditCode");
            this.trainList[i].examineYear = localStorage.getItem("examineYear");
          }
          stSaveCommendation(this.trainList).then(response => {
            this.$message({
              message: '保存培训职称评审鉴定认证成功',
              type: 'success'
            })
            this.getInfo();
          })
        }else{
          this.$message({
            message: '请填写完整！',
            type: 'error'
          });
        }
      });
      this.$refs.evaluationListRef.validate(valid=> {
        if (valid) {
          if(this.evaluationList == null || this.evaluationList.length == 0){
            return;
          }
          for (let i = 0; i < this.evaluationList.length; i++) {
            this.evaluationList[i].creditCode = localStorage.getItem("creditCode");
            this.evaluationList[i].examineYear = localStorage.getItem("examineYear");
          }
          stSaveEvaluation(this.evaluationList).then(response => {
            this.$message({
              message: '保存评比达标表彰情况成功',
              type: 'success'
            })
            this.getInfo();
          })
        }else{
          this.$message({
            message: '请填写完整！',
            type: 'error'
          });
        }
      });
      this.$refs.workshopListRef.validate(valid=> {
        if (valid) {
          if(this.workshopList == null || this.workshopList.length == 0){
            return;
          }
          for (let i = 0; i < this.workshopList.length; i++) {
            this.workshopList[i].creditCode = localStorage.getItem("creditCode");
            this.workshopList[i].examineYear = localStorage.getItem("examineYear");
          }
          stSaveWorkshop(this.workshopList).then(response => {
            this.$message({
              message: '保存研讨会、论坛活动成功',
              type: 'success'
            })
            this.getInfo();
          })
        }else{
          this.$message({
            message: '请填写完整！',
            type: 'error'
          });
        }
      });
    },
    getInfo() {
      getDictByCode('sourceFunding').then(response => {
        this.sourceFundingOptions = response.data
      })
      getDictByCode('eventMethod').then(response => {
        this.eventMethodOptions = response.data
      })
      getDictByCode('activityType').then(response => {
        this.activityTypeOptions = response.data
      })
      this.year = localStorage.getItem('examineYear')
      getTableInfoByPage(15).then(response => {
        this.expositionList = response.data.expositionList
        this.workshopList = response.data.workshopList
        this.evaluationList = response.data.evaluationList
        this.trainList = response.data.trainList
        if (this.expositionList == null || this.expositionList.length == 0) {
          this.expositionList = []
          this.isList1 = 2
        } else {
          this.isList1 = 1
        }
        console.log(this.isList1)
        if (this.workshopList == null || this.workshopList.length == 0) {
          this.workshopList = []
          this.isList2 = 2
        } else {
          this.isList2 = 1
        }
        if (this.evaluationList == null || this.evaluationList.length == 0) {
          this.evaluationList = []
          this.isList3 = 2
        } else {
          this.isList3 = 1
        }
        if (this.trainList == null || this.trainList.length == 0) {
          this.trainList = []
          this.isList4 = 2
        } else {
          this.isList4 = 1
        }
      })
      //政治面貌politics 学历xueli
      getDictByCode('politics').then(response => {
        this.politicsOptions = response.data
      })
    }
  }
}
</script>
<style scoped lang="scss">
.el-table {
  --el-table-row-hover-bg-color: rgba(39, 137, 238, 0.1);
  --el-table-border-color:#e0e5f0;
}
:deep(.el-card.is-always-shadow) {
  box-shadow: 0 1px 14px 0 rgba(209, 224, 239, 0.6)
}

/* 拉框选中 */
.el-select-dropdown__item {
  height: 24px;
  line-height: 24px;
  font-size: 12px;
}

/* 鼠标经过下拉框 */
.el-select-dropdown__item:hover {
  height: 24px;
  line-height: 24px;
  font-size: 12px;
}

.el-select-dropdown__item.selected {
  color: #2789EE;
}
.app-container {
  margin-top: 40px;
  margin-left: 15%;
  width: 70%;
}

.div-bg {
  width: 100%;
  background: #F0F0F0;
  height: 10px;
}

.box-card {
  width: 100%;
  margin-top: 20px;
  padding: 20px;
}

.el-col {
  padding-left: 5px;
}

.divider-title {
  font-weight: bold;
  font-size: 18px;
}

.custom-select .el-select-dropdown {
  max-height: 600px; /* 设置为你想要的高度 */
  overflow: auto; /* 添加滚动条 */
}

table {
  border-collapse: collapse; /* 确保表格的边框合并为单一边框 */
  width: 100%; /* 表格宽度 */
}

td {
  border: 1px solid #ababab; /* 设置单线边框 */
  padding: 6px; /* 单元格内边距 */
}

.el-form-item {
  margin-bottom: 0px;
}
</style>
